# -*- coding: utf-8 -*-
"""
@time：  2021/06/08  20:42
@Auto：Mr. xingye  993843278
@Company 星野训练营 99384378@qq.com
@Function:接口测试实例

"""
import requests

# 会话机制
session = requests.session()
# 1、关联Set-Cookie信息
# 2、快速的链接服务器

params = {
"username": 13893233624,
"password": 123456,
"verify_code": 111
}


results = session.post(url='http://42.192.168.57/index.php?m=Home&c=User&a=do_login&t=0.286263481644883',data=params)
# 状态码
print(results.status_code)
# 返回的cookie
print(results.cookies)
#打印请求url
print(results.url)
# 响应头
print(results.headers)
# 响应内容
print(results.text)
# 响应json
print(results.json())
#二进制utf-8解码
print(results.content.decode('utf-8'))
#二进制raw_unicode_escape解码
print(results.content.decode('raw_unicode_escape'))
print('-----------------')

results = session.get("http://42.192.168.57/index.php/Home/User/info.html")
print(results.cookies)
print(results.text)